using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Secretaria_Buscar : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

        if (!IsPostBack)
        {
            if (biFactory.User().IdPerfil == 0)
            {
                cboCursos.SourceData = "proc_CursoDisponibles ";
            }
            else {
                cboCursos.SourceData = "proc_CursoDisponibles " + biFactory.User().IdSede.ToString();
            }
            cboCursos.TipoOrigen = Controles_cboGeneric.TipoSource.Procedure;
            cboCursos.NameId = "IdCurso";
            cboCursos.NameDescript = "CursoDescrip";
            cboCursos.BindCBO();
        }
        ShowGrid();

    }
    protected void cmdBuscar_Click(object sender, EventArgs e)
    {
        ShowGrid();
    }

    private void ShowGrid()
    {
        if (biFactory.User().IdPerfil == 0)
        {
            gvAlumnos.DataSource = SchoolsBI.Materia.Tabla("proc_buscarAlumnos '" + txtBuscar.Text + "'," + cboCursos.Value );
        }
        else {
            gvAlumnos.DataSource = SchoolsBI.Materia.Tabla("proc_buscarAlumnos '" + txtBuscar.Text + "'," + cboCursos.Value + "," + biFactory.User().IdSede.ToString());
        }
        gvAlumnos.DataBind();
    }
}
